﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="UpdateDirectorate.aspx.cs" Inherits="SD.UI.UpdateDirectorate" Title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            height: 23px;
        }
        .style2
        {
            height: 30px;
        }
        .style3
        {
            width: 216px;
        }
        .style4
        {
            height: 23px;
            width: 216px;
        }
        .style5
        {
            height: 30px;
            width: 216px;
        }
        .style6
        {
            height: 26px;
        }
        .style7
        {
            width: 216px;
            height: 26px;
        }
    </style>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <table width="100%">
            <tr>
                <td colspan="2">
                    <div>
                        <h1>
                            Business Unit/Directorate Details
                        </h1>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <div style="float: right">
                        <asp:Button ID="btnInActive" runat="server" Text="In-active" OnClick="btnInActive_Click"
                            CausesValidation="False" CssClass="Button" />
                        <asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" 
                            style="height: 26px" CssClass="Button"/>
                        <asp:Button ID="btnBack" runat="server" Text="Back" CausesValidation="False" 
                            onclick="btnBack_Click" CssClass="Button" />
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div>
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <asp:TabContainer ID="TabContainer1" runat="server" 
                                OnActiveTabChanged="TabContainer1_ActiveTabChanged" 
            ActiveTabIndex="0">
        <asp:TabPanel ID="tabsDetail1" runat="server">
            <HeaderTemplate>
                Details
            </HeaderTemplate>
            <ContentTemplate>
                <div>
                    <asp:Panel ID="PanelDetails1" runat="server" Width="1180px">
                        <div>
                            <table width="100%">
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbOrgName" runat="server" Text="BU/Directorate Name"></asp:Label><asp:Label
                                                ID="lbValidOrgName" runat="server" BorderStyle="None" ForeColor="Red" Text="*"></asp:Label></div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxDirectorateName" runat="server" Width="250px"></asp:TextBox><asp:RequiredFieldValidator
                                                ID="RequiredFieldValidator1" runat="server" ControlToValidate="tbxDirectorateName"
                                                ErrorMessage="Please input the organization name."> 
                                                                    * </asp:RequiredFieldValidator>
                                        </div>
                                    </td>
                                    <td class="style3">
                                        <div>
                                            <asp:Label ID="lbTypeOfBussiness" runat="server" Text="Type Of Bussiness"></asp:Label>
                                            <asp:Label ID="lbValidTypeOfBussiness" runat="server" ForeColor="Red" Text="*"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <div onclick="ShowSearchBussinessType()">
                                            <asp:TextBox ID="tbxTypeOfBussiness" runat="server" Enabled="False" Width="250px"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="tbxTypeOfBussiness"
                                                ErrorMessage="Please input the type of bussiness."> *
                                            </asp:RequiredFieldValidator>
                                            <asp:LinkButton ID="linkTypeOfBussiness" runat="server" Text="Lookup"></asp:LinkButton>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td rowspan="2">
                                        <div>
                                            <asp:Label ID="lbOrgShortDescription" runat="server" Text="BU/Directorate Short Description"></asp:Label></div>
                                    </td>
                                    <td rowspan="2">
                                        <div>
                                            <asp:TextBox ID="tbxDirShortDes" runat="server" TextMode="MultiLine" Width="250px"></asp:TextBox></div>
                                    </td>
                                    <td class="style4">
                                        <div>
                                            <asp:Label ID="lbSICCode" runat="server" Text="SIC Code"></asp:Label>
                                        </div>
                                    </td>
                                    <td class="style1">
                                        <div>
                                            <asp:TextBox ID="tbxSICCode" runat="server" Enabled="False" Width="250px"></asp:TextBox>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style3">
                                        &nbsp;
                                    </td>
                                    <td>
                                        <div class="navi">
                                            <div>
                                            </div>
                                            <div onclick="ShowSearchBussinessType()">
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbLeadContact" runat="server" Text="Lead Contact"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="navi">
                                            <div>
                                                <asp:TextBox ID="tbxLeadContact" runat="server" Enabled="False" Width="250px"></asp:TextBox></div>
                                            <div onclick="ShowLeadContacts()">
                                                <asp:LinkButton ID="linkLookup" runat="server" Text="Lookup"></asp:LinkButton></div>
                                        </div>
                                    </td>
                                    <td class="style3">
                                        <div>
                                            <asp:Label ID="lbOrgFullDescription" runat="server" Text="Organization Full Description"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxDirFullDescription" runat="server" TextMode="MultiLine" Width="250px"></asp:TextBox>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style2" colspan="2">
                                        <div>
                                            <asp:CheckBox ID="ckbCoppyAddress" runat="server" Text="Coppy Address from Organization"
                                                AutoPostBack="True" OnCheckedChanged="ckbCoppyAddress_CheckedChanged" />
                                        </div>
                                    </td>
                                    <td class="style5">
                                        <div>
                                            <asp:Label ID="lbPhoneNumber" runat="server" Text="Phone Number"></asp:Label>
                                        </div>
                                    </td>
                                    <td class="style2">
                                        <asp:TextBox ID="tbxPhoneNumber" runat="server" Width="250px"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="tbxPhoneNumber"
                                            ErrorMessage="Please input the phone number."> *
                                        </asp:RequiredFieldValidator>
                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="tbxPhoneNumber"
                                            ErrorMessage="Invalid phone number." ValidationExpression="\d{10}">*</asp:RegularExpressionValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbAddressLine1" runat="server" Text="Address Line 1"></asp:Label><asp:Label
                                                ID="lbValidAddLine1" runat="server" ForeColor="Red" Text="*"></asp:Label></div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxAddressLine1" runat="server" Width="250px" ReadOnly="True" Enabled="False"></asp:TextBox><asp:RequiredFieldValidator
                                                ID="RequiredFieldValidator3" runat="server" ControlToValidate="tbxAddressLine1"
                                                ErrorMessage="Please input the address line 1."> * </asp:RequiredFieldValidator></div>
                                    </td>
                                    <td class="style3">
                                        <div>
                                            <asp:Label ID="lbFax" runat="server" Text="Fax"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxFax" runat="server" Width="250px"></asp:TextBox>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbAddressLine2" runat="server" Text="Address Line 2"></asp:Label></div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxAddressLine2" runat="server" Width="250px" ReadOnly="True" Enabled="False"></asp:TextBox><div>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="style3">
                                        <asp:Label ID="lbEmail" runat="server" Text="Email"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="tbxEmail" runat="server" Width="250px"></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="tbxEmail"
                                            Display="Dynamic" ErrorMessage="Please input email.">*</asp:RequiredFieldValidator>
                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="tbxEmail"
                                            Display="Dynamic" ErrorMessage="The email is not right format." ValidationExpression="^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z][a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$">*</asp:RegularExpressionValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbAddressLine3" runat="server" Text="Address Line 3"></asp:Label></div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxAddressLine3" runat="server" Width="250px" ReadOnly="True" Enabled="False"></asp:TextBox></div>
                                    </td>
                                    <td class="style3">
                                        <div>
                                            <asp:Label ID="lbWebAddress" runat="server" Text="Web Address"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxWebAddress" runat="server" Width="250px"></asp:TextBox>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbPostcode" runat="server" Text="Postcode"></asp:Label><asp:Label
                                                ID="lbValidPostcode" runat="server" ForeColor="Red" Text="*"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <div class="navi">
                                            <div>
                                                <asp:TextBox ID="tbxPostcode" runat="server" Enabled="False" Width="250px"></asp:TextBox></div>
                                            <div onclick="ShowSearchAddress()">
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="tbxPostcode"
                                                    ErrorMessage="Please input the postcode."> * </asp:RequiredFieldValidator>
                                                <asp:LinkButton ID="linkPostcode" runat="server" Text="Lookup"></asp:LinkButton></div>
                                        </div>
                                    </td>
                                    <td class="style3">
                                        <div>
                                            <asp:Label ID="lbCharityNumber" runat="server" Text="Charity Number"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxCharityNumber" runat="server" Width="250px"></asp:TextBox>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbCity" runat="server" Text="Town/Village/City"></asp:Label></div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxCityTown" runat="server" Width="250px" Enabled="False"></asp:TextBox></div>
                                    </td>
                                    <td class="style3">
                                        <div>
                                            <asp:Label ID="lbCompanyNumber" runat="server" Text="Company Number"></asp:Label>
                                        </div>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="tbxCompanyNumber" runat="server" Width="250px"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style6">
                                        <div>
                                            <asp:Label ID="lbCounty" runat="server" Text="County"></asp:Label></div>
                                    </td>
                                    <td class="style6">
                                        <div>
                                            <asp:TextBox ID="tbxCounty" runat="server" Width="250px" Enabled="False"></asp:TextBox></div>
                                    </td>
                                    <td class="style7">
                                    </td>
                                    <td class="style6">
                                        <div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div>
                                            <asp:Label ID="lbNationCountry" runat="server" Text="Nation/Country"></asp:Label></div>
                                    </td>
                                    <td>
                                        <div>
                                            <asp:TextBox ID="tbxNationCountry" runat="server" Width="250px" ReadOnly="True" Enabled="False"></asp:TextBox></div>
                                    </td>
                                    <td class="style3">
                                        <div>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                    <td class="style3">
                                        <div>
                                        </div>
                                    </td>
                                    <td>
                                        <div>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                        <div>
                                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </asp:Panel>
                </div>
            </ContentTemplate>
        </asp:TabPanel>
        <asp:TabPanel ID="TabDepartment" runat="server">
            <HeaderTemplate>
                Department
            </HeaderTemplate>
            <ContentTemplate>
                <div>
                    <table width="100%">
                        <tr>
                            <td colspan="3">
                                <div>
                                    <h1>
                                        Organization List
                                    </h1>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div id="menu">
                                    <p>
                                        <asp:LinkButton ID="lbnAll" runat="server" CausesValidation="False" OnClick="lbnAll_Click"
                                            Text="All"></asp:LinkButton>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="lbn09" runat="server" CausesValidation="False" OnClick="lbn09_Click"
                                            Text="0-9"></asp:LinkButton>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="lbnABCDE" runat="server" CausesValidation="False" OnClick="lbnABCDE_Click"
                                            Text="A B C D E"></asp:LinkButton>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="lbnFGHIJ" runat="server" CausesValidation="False" OnClick="lbnFGHIJ_Click"
                                            Text="F G H I J"></asp:LinkButton>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="lbnKLMN" runat="server" CausesValidation="False" OnClick="lbnKLMN_Click"
                                            Text="K L M N"></asp:LinkButton>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="lbnOPQR" runat="server" CausesValidation="False" OnClick="lbnOPQR_Click"
                                            Text="O P Q R"></asp:LinkButton>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="lbnSTUV" runat="server" CausesValidation="False" OnClick="lbnSTUV_Click"
                                            Text="S T U V"></asp:LinkButton>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="lbnWXYZ" runat="server" CausesValidation="False" OnClick="lbnWXYZ_Click"
                                            Text="W X Y Z"></asp:LinkButton>
                                    </p>
                                </div>
                            </td>
                            <td>
                                <div style="float: right">
                                    <asp:Button ID="btnCreateDepartment" runat="server" CausesValidation="False" CssClass="Button"
                                        OnClick="btnCreateDepartment_Click" Text="Create"></asp:Button>
                                    <asp:CheckBox ID="chkInActive" runat="server" AutoPostBack="True" OnCheckedChanged="chkInActive_CheckedChanged"
                                        Text="Include In-Active"></asp:CheckBox>
                                    
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                <div>
                                    <asp:GridView ID="gvDepartment" runat="server" AllowPaging="True" AllowSorting="True"
                                        AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None"
                                        BorderWidth="1px" CellPadding="3" CssClass="Org" DataKeyNames="DepartmentID"
                                        OnPageIndexChanging="gvDepartment_PageIndexChanging" OnSorting="gvDepartment_Sorting"
                                        PageSize="4" Width="100%">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Department Name" SortExpression="Name">
                                                <ItemTemplate>
                                                    <a href="#" onclick="onDepartClick(this);">
                                                        <%#DataBinder.Eval(Container.DataItem,"Name") %></a>
                                                    <asp:HiddenField ID="hddepartmentId" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"DepartmentID") %>' />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="Line1" HeaderText=" Address Line 1" 
                                                SortExpression="Line1">
                                            </asp:BoundField>
                                            <asp:BoundField DataField="PostCode" HeaderText="Postcode" SortExpression="PostCode">
                                            </asp:BoundField>
                                            <asp:BoundField DataField="Surname" HeaderText="Contact" SortExpression="Surname">
                                            </asp:BoundField>
                                            <asp:BoundField DataField="IsActive" HeaderText="Is Avtice?" SortExpression="IsActive">
                                            </asp:BoundField>
                                        </Columns>
                                        <AlternatingRowStyle BackColor="#F7F7F7"></AlternatingRowStyle>
                                        <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C"></FooterStyle>
                                        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7"></HeaderStyle>
                                        <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right"></PagerStyle>
                                        <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C"></RowStyle>
                                        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7"></SelectedRowStyle>
                                    </asp:GridView>
                                    <br />
                                    <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &#160;&nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:TabPanel>
    </asp:TabContainer>
    <table>
            <tr>
                <td>
                    <asp:HiddenField ID="txtContactID" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="txtAddressID" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="txtBussinessID" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:HiddenField ID="hdfContactName" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hdfLine1" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hdfLine2" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:HiddenField ID="hdfLine3" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hdfPostCode" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hdfTown" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:HiddenField ID="hdfCounty" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hdfCountry" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hdfBussiness" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hdfSicCode" runat="server" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>

